<#
 #   It is recommended to test the script on a local machine for its purpose and effects. 
 #   ManageEngine Endpoint Central will not be responsible for any 
 #   damage/loss to the data/setup based on the behavior of the script.

 #   Description: Script is designed to Rename the Local User Account Name
 #   Configuration Type - COMPUTER
 #   Note : The old local user name and the new user name need to be hardcoded.
#>

# Rename the local account
try {
    Rename-LocalUser -Name "OldLocalUserName" -NewName "NewLocalUserName" -ErrorAction Stop  #The values need to be hardcoded here
    Write-Output "User renamed successfully."
} catch {
    Write-Output "Error occurred: $_"
}